<template>
    <div class="head">
        <van-nav-bar title="团队信息" left-arrow @click-left="onClickLeft" />
    </div>
    <van-tabs v-model:active="active">
        <van-tab title="一级"><van-empty :description="statusWord" v-if="status == 2" /></van-tab>
        <van-tab title="二级"><van-empty :description="statusWord" v-if="status == 2" /></van-tab>
    </van-tabs>
</template>

<script setup>
import axios from 'axios';
import { onUpdated } from 'vue';
import { ref } from 'vue';


const onClickLeft = () => history.back();
const active = ref(0);
let userId = sessionStorage.getItem('userId')
let scienceData = JSON.parse(sessionStorage.getItem('scienceData'))
const status = ref()
const statusWord = ref('')
axios({ //请求用户信息
    url: "/api/personal/team", // url
    params: {
        // 参数
        userid: userId,
        type: active.value + 1,
        scienceid: scienceData.id
    },
})
    .then(function (res) {
        console.log(res); // 成功回调
        status.value = res.data.status
        statusWord.value = res.data.msg
    })
    .catch(function (err) {
        console.log(err); // 失败回调
    });
onUpdated(() => {
    axios({ //请求用户信息
        url: "/api/personal/team", // url
        params: {
            // 参数
            userid: userId,
            type: active.value + 1,
            scienceid: scienceData.id
        },
    })
        .then(function (res) {
            console.log(res); // 成功回调
            status.value = res.data.status
            statusWord.value = res.data.msg

        })
        .catch(function (err) {
            console.log(err); // 失败回调
        });
})
</script>

<style scoped></style>